include("ALBreIF/ALBreIF.jl")
include("BPGF/BPGF.jl")
using .ALBreIF
using .BPGF

using Images
ul = "ORL_Faces/s1/1.pgm"
ig = load(ul)

a, b = size(ig)
R = 5

B = Matrix{Float64}(undef, a*b, 400)
for i = 1 : 40
    for j = 1 : 10
        local url = "ORL_Faces/s"*"$i/"*"$j"*".pgm"
        local img = load(url)
        local q = float64.(channelview(img))
        q = q[:]
        global B[:, (i-1)*10 + j] = q
    end
end

A = BPGF.normalize!(B)
X, Y = BPGF.randinit(A, R^2, 0.2, 1.0)

ρ₀ = 0.2 # step size parameter
μ₀ = 0.001 # regularization cofficient
μ_1 = 0.0001 # regularization coefficient
μ = 0.0 # another regularization coefficient
rtime = 300 # runtime
version = true

X₂ = copy(X);
Y₂ = copy(Y);
r₂ = BPGF.solve!(BPGF.BBPG{Float64}(runtime=rtime,
                verbose=version,
                ρ=0.1,
                μ₁=μ_1,
                μ₂=μ), A, X₂, Y₂)